/* packets.cpp
 *
 * --
 * Copyright (c) 2012, Christophe Huriaux
 * Distributed under the terms of the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * --
 */

#include <packet/packets.h>

int packetInitialize(McPacketFromServer** packet, unsigned char id)
{
    switch (id)
    {
        case 0x00:
            *packet = static_cast<McPacketFromServer*>(new pfs00KeepAlive());
            return 0;

        case 0x01:
            *packet = static_cast<McPacketFromServer*>(new pfs01Login());
            return 0;

        case 0x02:
            *packet = static_cast<McPacketFromServer*>(new pfs02Handshake());
            return 0;

        case 0x03:
            *packet = static_cast<McPacketFromServer*>(new pfs03ChatMessage());
            return 0;

        case 0x04:
            *packet = static_cast<McPacketFromServer*>(new pfs04TimeUpdate());
            return 0;

        case 0x05:
            *packet = static_cast<McPacketFromServer*>(new pfs05EntityEquipment());
            return 0;

        case 0x06:
            *packet = static_cast<McPacketFromServer*>(new pfs06SpawnPosition());
            return 0;

        case 0x0D:
            *packet = static_cast<McPacketFromServer*>(new pfs0DPlayerPositionAndLook());
            return 0;

        case 0x12:
            *packet = static_cast<McPacketFromServer*>(new pfs12Animation());
            return 0;

        case 0x32:
            *packet = static_cast<McPacketFromServer*>(new pfs32PreChunk());
            return 0;

        case 0x33:
            *packet = static_cast<McPacketFromServer*>(new pfs33MapChunk());
            return 0;

        case 0x82:
            *packet = static_cast<McPacketFromServer*>(new pfs82UpdateSign());
            return 0;

        case 0xFF:
            *packet = static_cast<McPacketFromServer*>(new pfsFFKick());
            return 0;

        default:
            *packet = NULL;
            return -1;
    }
}
